'''
find target id in labels dir
'''
import os
import re
#num = 1

for file in os.listdir(path='/home/unionsys/Pictures/jr1031/labels/train/'):
    
    with open('/home/unionsys/Pictures/jr1031/labels/train/'+file, "r+", encoding='utf-8') as f:
    # readlines()：读取文件全部内容，以列表形式返回结果
        data = f.readlines()
        
        changed_data = ''
        for item in data:
            #print(item)
            text = list(item)    #将字符串转换为列表，列表的每一个元素为一个字符
            #print(text[0])
            if (text[0]=='8'):
                #text[0] = '2' 
                print(item)
                print(file)
            #else:
                #text = ''.join(text)     #将列表重新连接为字符串
            #changed_data = changed_data+text
            #print(text)
        #newf = open('/home/unionsys/Pictures/1020/02/labels/'+file, 'a', encoding='utf-8')
        #newf.write(changed_data)
        #newf.close()
